package bookoperation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddBook implements IOperation{

    @Override
    public void show(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入书名:>");
        String bookName = scanner.nextLine();
        System.out.print("请输入作者:>");
        String author = scanner.nextLine();
        System.out.print("请输入价格:>");
        int price = scanner.nextInt();
        scanner.nextLine();
        System.out.print("请输入类型:>");
        String type = scanner.nextLine();
        int size = bookList.getUseSize();
        Book books = new Book(bookName,author,price,type);
        bookList.setBooks(books);
        bookList.setUseSize(size+1);
        System.out.println("添加完成!");
    }
}
